﻿@using DAL.Model;
@{
    ViewBag.Title = "终端录入";
    var F = Html.F();

    SaltTerminal terminal = ViewBag.SaltTerminal;
    if (terminal == null)
    {
        terminal = new SaltTerminal();
    }
}

@section body{
    @(F.Form()
        .ID("Form1")
        .LabelAlign(LabelAlign.Right)
        .MessageTarget(MessageTarget.Qtip)
        .LabelWidth(90)
        .ShowBorder(false)
        .ShowHeader(false)
        .Items(
            F.Panel()
                .ID("Panel1")
                .Title("终端录入")
                .BoxFlex(5)
                .MarginRight(5)
                .ShowBorder(false)
                .ShowHeader(false)
                .Items(
                     F.HiddenField()
                        .ID("ID")
                        .Text(terminal.ID != 0 ? terminal.ID.ToString() : "0"),
                     F.TextBox()
                         .ID("Name")
                         .Label("名称")
                         .ShowRedStar(true)
                         .Required(true)
                         .Text(terminal.Name != null ? terminal.Name : ""),
                     F.TextBox()
                         .ID("Contact")
                         .Label("联系人")
                         .ShowRedStar(true)
                         .Required(true)
                         .Text(terminal.Contact != null ? terminal.Contact : ""),
                     F.TextBox()
                        .ID("Address")
                        .Label("Address")
                        .ShowRedStar(true)
                        .Required(true)
                        .Text(terminal.Address != null ? terminal.Address : ""),
                    F.TextBox()
                        .ID("Phone")
                        .Label("电话")
                        .Text(terminal.Phone != null ? terminal.Phone : "")


                )
        )
        .Toolbars(
            F.Toolbar()
                .ID("Toolbar1")
                .ToolbarAlign(ToolbarAlign.Right)
                .Position(ToolbarPosition.Bottom)
                .Items(
                    F.Button()
                        .ID("Button1")
                        .Text("保存信息")
                        .ValidateForms("Form1")
                        .OnClick(Url.Action("SaveSaltTerminal"), "Form1")
                        .ValidateMessageBox(false)
                )
        )
    )
}
